<template>

  <div class="market-head">
    <div class="left">{{data.name}}</div>
    <div class="right">
      <div v-for="item in list" :key="item.key" class="item">
        <div class="label">{{item.label}}：</div>
        <div class="value">{{data[item.key]}}</div>
      </div>
    </div>
  </div>

</template>

<script>
import { mapState } from "vuex"
import {
  getCategoryAndDashboardListByPid,
  batchDelDashboardCategory,
  batchDelDashboard,
  kanBanOnlineOrOffline,
  applySubscribe,
  applyStore,
  upDashboard
} from "@/api/multidimensionalAnalysis"

export default {
  components: {
  },
  props: {
    data: {
      type: Object,
      default: ()=> {}
    }
  },
  data() {
    return {
      list: [
        {
          label: "调用数",
          key: "subscribeNum"
        },
        {
          label: "发布时间",
          key: "publishTime"
        },
        {
          label: "创建人",
          key: "createUser"
        },
        {
          label: "收藏数",
          key: "storeNum"
        }
      ]
    }
  },
  computed: {
    ...mapState("lowCode", {
      previewData: state => state.previewData
    })
  },
  created(){

  },
  methods: {

    handleOk(){
      console.log(this.form.name)
      this.$refs.formRef.form.validate( value => {
        if(value){
          this.confirmLoading = true
          applySubscribe({id: this.id, subEndTime: encodeURIComponent(`${this.form.subEndTime  } 23:59:59`)})
          .then(res => {
            this.confirmLoading = false
            if (res.code === "000000") {
              this.$message.success("申请收藏成功")
              this.hide()
            } else {
              this.$message.error(res.msg)
            }
          })
          .catch(err => {
            this.confirmLoading = false
            this.$message.error(err.response.data.message)
          })
        }
      })

    },
    hide() {
      this.visible = false
      this.form = {
        subEndTime: ""
      }
    },
    show() {
      this.form.name = this.data.name
      this.visible = true
    },
    handleCancel() {
      this.hide()
    }

  },

}
</script>

<style lang="less" scoped>
@import url("./index.less");
</style>
